Problem Challenge 3

Count of Structurally Unique Binary Search Trees (hard) #

Given a number ‘n’, write a function to return the count of structurally unique Binary Search Trees (BST) that can store values 1 to ‘n’.

Example 1:

Input: 2
Output: 2
Explanation: As we saw in the previous problem, there are 2 unique BSTs storing numbers from 1-2.

Example 2:

Input: 3
Output: 5
Explanation: There will be 5 unique BSTs that can store numbers from 1 to 5.

Try it yourself #

Try solving this question here:

Output

0.696s

Total trees: -1 Total trees: -1

Mark as Completed
←    Back
Solution Review: Problem Challenge 2
Next    →
Solution Review: Problem Challenge 3